let lishow = document.querySelectorAll('.ms-nav ul li');
lishow[0].style.backgroundColor = 'red';
for (let i = 0; i < lishow.length; i++) {
    lishow[i].dataset.index = i;
    console.log(lishow);
}
let show = lishow[0];

let allCon = document.querySelectorAll('.ms-con');
let previousShowDiv = allCon[0];
console.log(allCon[0]);
document.querySelector('.ms-nav').onclick = function () {

    //改变展示商品的块  
    previousShowDiv.style.display = 'none';
    allCon[event.target.dataset.index].style.display = 'flex';

    previousShowDiv = allCon[event.target.dataset.index];

    //改变导航栏点击块的背景颜色
    show.style.backgroundColor = '';
    lishow[event.target.dataset.index].style.backgroundColor = 'red';

    show = lishow[event.target.dataset.index];
}